<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    {include file="/layout/scriptload"}
    <title>添加宗分类</title>
</head>
<body>
<div class="box">
    <!-- /.box-header -->
    <section class="content">
        <div class="box-body">
            <form role="form">
                <div class="form-group col-md-7">
                    <label>总分类名称</label>
                    <input type="text" id="categoryname" class="form-control"  placeholder="请输入...">
                </div>
                <div class="form-group col-md-7">
                    <label>分类说明</label>
                    <input type="text" id="remark" class="form-control"  placeholder="请输入...">
                </div>

                <div class="form-group col-md-7" >
                    <div id="btn_save" class="btn pull-right" style="background: #18bc9c;color: #ffffff;">保存</div>
                </div>
            </form>
        </div>
    </section>
</div>
</body>
<script>
    $(function(){
        $('#btn_save').click(function(){
            var _categoryname = $('#categoryname').val();
            var _remark = $('#remark').val();
            if(_categoryname == ''){
                layerAlert('总分类名称不能为空');
                return false;
            }
            $.ajax({
                type:'post',
                cache: false,
                url:"{:url('replyfans/doAddCategorysum')}",
                data:{categoryname:_categoryname,level:1,remark:_remark,pid:0},
                success:function(data){
                    if(data.code==0){
                        layerAlert(data.msg,function(){
                            parent.relist();
                            layerParentClose();
                        });
                    }else{
                        layerAlert(data.msg);
                    }
                }
            })
        })
    })
</script>
</html>